home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / utilities / boot / magicscrip.lha / MagicScripts / MagicExtract.sh < prev    next >
Encoding:
Text File  |  1995-01-15  |  2.1 KB  |  76 lines

  1. # MagicView for ToolManager using ReqAsk
  2. # and CSH.
  3. # Can be used by DOCKs, APPICONs or CLI
  4. # $VER: MagicExtract 1.0 14/1/95 Jonathan Benson
  5.  
  6. csh:class
  7. set MagicExt :
  8.  
  9. if -n $_passed
  10.     set MagicDir :
  11.     set MagicFile ""
  12.     label request
  13.     set _passed =  @filereq( "Please select the file(s)" $MagicDir"#?" $MagicFile )
  14.     set MagicRep true
  15. else
  16.     set MagicRep false
  17. endif
  18.  
  19. if -n $_passed = ""
  20.     set MagicDir  @dirname( ""$_passed"" )/
  21.     set MagicFile  @basename( ""$_passed"" )
  22.  
  23.     if $MagicDir = "/"
  24.         tackon _passed $_cwd $_passed
  25.     set MagicDir $_cwd
  26.     endif
  27.  
  28.     if $MagicDir = ":/"
  29.         tackon _passed $_cwd $_passed
  30.     set MagicDir $_cwd
  31.     endif
  32.  
  33.     ReqAsk "Would you like me to:*nView the file,*nExtract it to Current Directory*nor Extract it to elsewhere" TITLE "MagicExtract Requester" GADFMT "Extract|View|Elsewhere|Forget it!" GLOBAL
  34.  
  35.     if $ReqAskResult = 1
  36.         xtr $_passed
  37.         ReqAsk "OK, Finished extracting*nfile to Current Directory" TITLE "Press RETURN or ESC to continue" GADFMT "Bye" GLOBAL
  38.     endif
  39.  
  40.     if $ReqAskResult = 2
  41.         v $_passed >T:MagicExtract.tmp
  42.             more T:MagicExtract.tmp
  43.             rm T:MagicExtract.tmp
  44.     endif
  45.  
  46.     if $ReqAskResult = 3
  47.             set MagicExt  @filereq( "Please select the destination directory" $MagicExt/ )
  48.         cd $MagicExt
  49.             xtr $_passed
  50.         ReqAsk "OK, Finished extracting*nfile to elsewhere" TITLE "Press RETURN or ESC to continue" GADFMT "Bye" GLOBAL
  51.     endif
  52.  
  53.     if $MagicRep = true
  54.         setenv ReqAskResult 0
  55.         goto request
  56.     endif
  57. endif
  58.  
  59. label end
  60. setenv ReqAskResult 0
  61. return
  62.  
  63. # Thanks to Magnus Holmgren for creating the wonderful
  64. # ReqChange, and ReqAsk,
  65. # and to Nico François for his superb ReqTools library,
  66. # and of course lets not forget Stefan Boberg.
  67. # And to Stefan Becker for ToolManager.
  68. # And to the guy who wrote UnLha who inspired this
  69. # little script. (sorry I couldn't see your name anywhere)
  70. # And of course to the following for CShell:
  71. #     Shell V2.04 (C)Copyright 1986, Matthew Dillon, All Rights Reserved
  72. #     Shell V2.04M-V2.07M by Steve Drew
  73. #     Shell V2.08MI, V3.xxA and V4.xxA by Carlo Borreo & Cesare Dieni
  74. #     Shell V5.xxL by U. Dominik Mueller
  75. #     Shell V5.20+ by Andreas M. Kirchwitz
  76.